var util = require('../util/util')

function ipRecord(req,res,next){
	var ip = req.headers['x-forwarded-for']||req.connection.remoteAddress||req.socket.remoteAddress;
	var data = JSON.stringify({
		ip:ip,
		time:new Date().toLocaleString()
	})
	util.appendFile('/public/record/ipRecord.txt',data)
	next();
}

module.exports = ipRecord;